<template>
      <div id="appversionwrap">
        <div class="actionBar">
          <div>
            当前状态：共<span>{{total}}</span>版本
          </div>
        </div>
        <table class="table">
          <thead>
            <tr>
              <th>文件名</th>
              <th>版本号</th>
              <th>文件大小</th>
              <th>发布日期</th>
              <th>强制更新</th>
              <th>更新日志</th>
              <th>公开范围</th>
              <th>文件上传日期</th>
              <th>操作</th>
            </tr>
          </thead>
          <tbody>
            <tr v-for="(item, index) in appList">
              <td>{{index + 1}}</td>
              <td>{{item.version}}</td>
              <td>{{item.fileSize}}</td>
              <td>{{item.publishTime}}</td>
              <td>{{item.forceUpgrade}}</td>
              <td>{{item.releaseLog}}</td>
              <td>{{item.publishScope}}</td>
              <td>{{item.updateTime}}</td>
              <td><span>下载</span><span>修改</span><span>删除</span></td>
            </tr>
          </tbody>
        </table>
      </div>
</template>
<script>
  import axios from 'axios'
  export default{
    name: 'appversionList',
    data () {
      return {
        total: 0,
        appList: []
      }
    },
    beforeCreate () {
      this.$store.commit('CHANGESTATE', [1, 0, 0, 0, 0, 0])
    },
    created () {
      this.axios(1)
    },
    methods: {
      axios (index) {
        axios({
          headers: {
            'Content-Type': 'application/x-www-form-urlencoded',
            'token': this.$store.state.token
          },
          url: this.$store.state.baseURI + 'oss/app/list',
          method: 'get',
          params: {
            page_num: index
          }
        }).then(obj => {
          console.log(obj)
          if (obj.data.code === 100) {
            this.total = obj.data.data.total
            this.appList = obj.data.data.list
          } else {
            this.$router.push('/')
          }
        })
      }
    }
  }
</script>
<style>
  .actionBar{
    height: 60px;
  }
  .table td{
    padding: 10px 0;
  }
</style>
